class Solution {
    vector<vector<string>> ret;
    unordered_map<string,vector<string>> has;
public:
    vector<vector<string>> groupAnagrams(vector<string>& strs) {
        for(int i=0;i<strs.size();i++)
        {
            string t=strs[i];
            sort(t.begin(),t.end());

            has[t].push_back(strs[i]);
        }
        
        for(auto &e:has)
        {
            ret.push_back(e.second);
        }
        return ret;
    }
};
